<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>智联同城——小程序管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/style.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css" />
    <link rel="stylesheet" href="__PUBLIC__/layui/css/font.css">
    <link rel="stylesheet" href="__PUBLIC__/layui/css/xadmin.css">
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <style type="text/css">
        .tongji-box{
            text-align: center;
            background: #63BA79;
            padding:20px;
            color: #fff;
        }
        .tongji-title{
            font-size: 26px;
        }
        .tongji-num{
            font-size: 24px;
        }
        #chart-box{
            margin-top: 30px;
            height: 500px;
        }
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">智联同城</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item "><a href="{:U('Index/index')}">首页</a></li>
            <li class="layui-nav-item"><a href="{:U('InfoCate/index')}">分类信息管理</a></li>
            <li class="layui-nav-item"><a href="{:U('ShopCate/index')}">好店管理</a></li>
            <li class="layui-nav-item"><a href="{:U('Quan/index')}">同城圈管理</a></li>
            <li class="layui-nav-item"><a href="{:U('Member/index')}">用户管理</a></li>
            <li class="layui-nav-item"><a href="{:U('Takeout/index')}">餐饮管理</a></li>
            <li class="layui-nav-item layui-this" ><a href="{:U('Credit/flash')}">积分商城</a></li>
            <li class="layui-nav-item"><a href="{:U('Home/Index/index')}">切换小程序</a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="{$Think.session.wechat.headimg}" class="layui-nav-img">
                    {$Think.session.wechat.nickname}
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="{:U('Home/Index/index')}">切换小程序</a></dd>
                    <!-- <dd><a href="">安全设置</a></dd> -->
                </dl>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="{$Think.session.headimgurl}" class="layui-nav-img">
                    {$Think.session.nickname}
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="{:U('Home/Public/logout')}">退出登录</a></dd>
                    <!-- <dd><a href="">安全设置</a></dd> -->
                </dl>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">积分商品</a>
                    <dl class="layui-nav-child">
                        <dd class=""><a href="{:U('credit/goodsCate')}">&nbsp;&nbsp;&nbsp;&nbsp;分类管理</a></dd>
                    </dl>
                    <dl class="layui-nav-child">
                        <dd class="layui-this"><a href="{:U('credit/goodsAdmin')}">&nbsp;&nbsp;&nbsp;&nbsp;商品管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="" href="javascript:;">设置</a>
                    <dl class="layui-nav-child">
                        <dd class=""><a href="{:U('credit/setBasic')}">&nbsp;&nbsp;&nbsp;&nbsp;基本设置</a></dd>
                    </dl>
                </li>

            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding:0 15px;">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;margin-bottom: 0;">
                <legend>积分商品管理</legend>
            </fieldset>

            <div class="layui-row" style="margin: 0px 0px 0px 20px;">
                <form class="layui-form layui-col-md12 x-so" action="{:U(Credit/goodsAdmin)}" method="post">
                    <div class="layui-input-inline">
                        <select name="is_stop">
                            <option value="">活动状态</option>
                            <option value="0">开启</option>
                            <option value="1">暂停</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="type_id">
                            <option value="">商品分类</option>
                            <foreach name="type" item="v">
                                <option value="{$v.id}">{$v.name}</option>
                            </foreach>
                        </select>
                    </div>
                    <input type="text" name="name"  placeholder="请输入关键字" autocomplete="off" class="layui-input">
                    <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                </form>
            </div>

            <div>
                <button id="add" class="layui-btn">添加商品</button>
            </div>
            <table class="layui-table">
                <colgroup>
                    <col width="100">
                </colgroup>
                <thead>
                <tr>
                    <th>排序</th>
                    <th>商品名称</th>
                    <th>商品Logo</th>
                    <th>消耗</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="list" item="vo">
                    <tr>
                        <td>{$vo.order_num}</td>
                        <td>{$vo.name}</td>
                        <td><img class="layui-nav-img" src="{$vo.img}"></td>
                        <td><text style="color: blue;">{$vo.rate1}</text> 积分 + <text style="color: red;">{$vo.rate2} </text>元</td>
                        <td>
                            <if condition="$vo['is_stop'] eq 0">
                                <text style="color: blue;">启用</text>
                            <elseif condition="$vo['is_stop'] eq 1" />
                                <text style="color: red;">暂停</text>
                            </if>
                        </td>
                        <td>
                            <button data-id="{$vo.id}" class="edit layui-btn layui-btn-small">编辑</button>
                            <button data-id="{$vo.id}" class="del layui-btn layui-btn-small">删除</button>
                        </td>
                    </tr>
                </foreach>
                </tbody>
            </table>
            <!-- <div id="page-box"></div> -->
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © 2017-2018 <a href="https://www.58zltc.com" target="_blank">智联同城</a> All Rights Reserved.
    </div>
</div>
<script src="__PUBLIC__/js/echarts.min.js" charset="utf-8"></script>
<script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
<script>
    //JavaScript代码区域
    layui.use(['form','upload','element','laypage','layer'], function(){
        var element = layui.element;
        var form = layui.form
                ,$ = layui.jquery

        $("#add").click(function(event) {
            layer.open({
                type: 2,
                title: '添加商品',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['1000px', '800px'],
                content: '{:U("add_goods")}'
            });
        });
        $(".edit").click(function(){
            var id = $(this).data('id');
            layer.open({
                type: 2,
                title: '编辑分类',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['1000px', '800px'],
                content: '{:U("add_goods")}?id='+ id
            });
        });
        $(".del").click(function(){
            var id = $(this).data('id');
            $.post("{:U('delGoods')}", {id: id}, function(e) {
                if(e.status == 1){
                    layer.msg(e.info,{icon: 6,time:1000});
                    setTimeout("location.reload()",1000);
                }else{
                    layer.msg(e.info,{icon:1,time:1000});
                }
            });
        });
    });



    var myChart = echarts.init(document.getElementById('chart-box'));
    var option = {
        title: {
            text: '一周趋势'
        },
        tooltip: {},
        legend: {
            data:['访问次数','访问人数']
        },
        xAxis: {
            data: ["2017-10-12","2017-10-13","2017-10-14","2017-10-15","2017-10-16","2017-10-17","2017-10-18"]
        },
        yAxis: {},
        series: [{
            name: '访问次数',
            type: 'bar',
            data: [2, 2, 3, 4, 5, 6, 7]
        },{
            name: '访问人数',
            type: 'bar',
            data: [1, 1, 2, 1, 2, 3, 5]
        }],
        color: ['#FFB800','#FF5722', '#01AAED', '#5FB878', '#91c7ae','#749f83',  '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3']
    };
    myChart.setOption(option);
</script>
</body>
</html>
